]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
messageTray: Record actions added to notifications
authorFlorian Müllner <fmuellner@gnome.org>
Thu, 19 Feb 2015 12:45:31 +0000 (13:45 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Fri, 20 Feb 2015 16:41:34 +0000 (17:41 +0100)
Both the screen shield and the notification section in the message
list create their own UI for notifications rather than using the
notification actor itself. Currently there is no clean way for such
representations to include notification actions - we will need this
as we will soon use a separate actor for banners as well, so keep
track of actions added via addAction().

js/ui/messageTray.js

index 96fa917b8cff27f18a5a83ac6dfc2a8c4a7ec4ae..a9ee24f06051c2043a772f8632fc21f7c3e5ce16 100644 (file)
@@ -495,6 +495,7 @@ const Notification = new Lang.Class({
         this._soundName = null;
         this._soundFile = null;
         this._soundPlayed = false;
+        this.actions = [];
 
         this.actor = new St.Button({ accessible_role: Atk.Role.NOTIFICATION });
         this.actor.add_style_class_name('notification-unexpanded');
@@ -594,6 +595,7 @@ const Notification = new Lang.Class({
             this._actionArea.destroy();
             this._actionArea = null;
             this._buttonBox = null;
+            this.actions = [];
         }
         if (!this._scrollArea && !this._actionArea)
             this._table.remove_style_class_name('multi-line-notification');
@@ -818,6 +820,7 @@ const Notification = new Lang.Class({
     // action buttons will appear in a single row at the bottom of
     // the notification.
     addAction: function(label, callback) {
+        this.actions.push({ label: label, callback: callback });
         let button = new St.Button({ style_class: 'notification-button',
                                      label: label,
                                      can_focus: true });